import React, { useEffect, useState } from "react";
import "./index.css"
import Top from "./components/top"
import { withRouter } from "react-router-dom";

import Dialog from "./components/dialog"
import Dia from "./components/dia"
const Detail = (props) => {
    const { name, price, img, integral,uid,coid,type} = props.location.state
    const userIntegral = {name,price,img,integral,uid,coid,type}
    return (
        <div className="d">
            <Top title='兑换商品详情'></Top>
            <div className="tb">
                <img src={img} alt='' />
                <div className="skr">
                    <li><div className="scroe">
                        <span>{price}</span>
                    </div>
                        <div className="content">
                            <h2>{name}</h2>
                            <span>兑换须知</span>
                            <p>本券兑换后61内有效</p>
                            <span>使用须知</span>
                            <p>1.鱼酷店内食用整份鱼品且满100元时可用</p>
                            <p>2.优惠券抵扣金额不找零不折现</p>
                            <p>3.不与其他优惠活动同享</p>
                        </div></li>
                </div>
            </div>
            <div className="change">
                {integral > price ? <Dia userIntegral={userIntegral}></Dia> : <Dialog></Dialog>}
                {/* {integral > price ? integral-price : integral} */}
            </div>
        </div>
    )
}
export default withRouter(Detail)